
class Api {

  constructor () {
    this.API_HOST = "http://xxx.com/xxx";
  }

  ajax (data = '', fn, method = "get", header = {}) {
      wx.request({
        url: this.API_HOST + data,
        method: method ? method : 'get',
        data: {},
        header: header ? header : { "Content-Type": "application/json" },
        success: function (res) {
          fn(res);
        }
      });
  }

}

export { Api }